package com.ace.model.bo;

/***********************************************************************
 * Module:  Marque.java
 * Author:  a.kanwar
 * Purpose: Defines the Class Marque
 ***********************************************************************/

import java.util.*;


public class Marque {
   
    /********************************************************************
     * Attribute
     ********************************************************************/
    
   private int idMarque;
   private java.lang.String libelle;
   private java.util.Collection<Vehicule> vehicule;
   private java.util.Collection<Modele> modele;
   
   
   
   /*********************************************************************
    * Constructor
    *********************************************************************/
   public Marque(int idMarque, String libelle, Collection<Vehicule> vehicule, Collection<Modele> modele) {
        this.idMarque = idMarque;
        this.libelle = libelle;
        this.vehicule = vehicule;
        this.modele = modele;
   }

    public Marque(String libelle, Collection<Vehicule> vehicule, Collection<Modele> modele) {
        this.libelle = libelle;
        this.vehicule = vehicule;
        this.modele = modele;
    }

    /***************************************************************************
     * getters and setters
     **************************************************************************/
    public int getIdMarque() {
        return idMarque;
    }

    public void setIdMarque(int idMarque) {
        this.idMarque = idMarque;
    }

    public String getLibelle() {
        return libelle;
    }

    public void setLibelle(String libelle) {
        this.libelle = libelle;
    }

    @Override
    public String toString() {
        return "Marque{" + "idMarque=" + idMarque + ", libelle=" + libelle + ", vehicule=" + vehicule + ", modele=" + modele + '}';
    }

    
    
   
   /*********************************************************************
    * generate code by power AMC
    *********************************************************************/
   public java.util.Collection<Vehicule> getVehicule() {
      if (vehicule == null)
         vehicule = new java.util.HashSet<Vehicule>();
      return vehicule;
   }
   
   /** @pdGenerated default iterator getter */
   public java.util.Iterator getIteratorVehicule() {
      if (vehicule == null)
         vehicule = new java.util.HashSet<Vehicule>();
      return vehicule.iterator();
   }
   
   /** @pdGenerated default setter
     * @param newVehicule */
   public void setVehicule(java.util.Collection<Vehicule> newVehicule) {
      removeAllVehicule();
      for (java.util.Iterator iter = newVehicule.iterator(); iter.hasNext();)
         addVehicule((Vehicule)iter.next());
   }
   
   /** @pdGenerated default add
     * @param newVehicule */
   public void addVehicule(Vehicule newVehicule) {
      if (newVehicule == null)
         return;
      if (this.vehicule == null)
         this.vehicule = new java.util.HashSet<Vehicule>();
      if (!this.vehicule.contains(newVehicule))
      {
         this.vehicule.add(newVehicule);
         newVehicule.setMarque(this);      
      }
   }
   
   /** @pdGenerated default remove
     * @param oldVehicule */
   public void removeVehicule(Vehicule oldVehicule) {
      if (oldVehicule == null)
         return;
      if (this.vehicule != null)
         if (this.vehicule.contains(oldVehicule))
         {
            this.vehicule.remove(oldVehicule);
            oldVehicule.setMarque((Marque)null);
         }
   }
   
   /** @pdGenerated default removeAll */
   public void removeAllVehicule() {
      if (vehicule != null)
      {
         Vehicule oldVehicule;
         for (java.util.Iterator iter = getIteratorVehicule(); iter.hasNext();)
         {
            oldVehicule = (Vehicule)iter.next();
            iter.remove();
            oldVehicule.setMarque((Marque)null);
         }
      }
   }
   /** @pdGenerated default getter */
   public java.util.Collection<Modele> getModele() {
      if (modele == null)
         modele = new java.util.HashSet<Modele>();
      return modele;
   }
   
   /** @pdGenerated default iterator getter */
   public java.util.Iterator getIteratorModele() {
      if (modele == null)
         modele = new java.util.HashSet<Modele>();
      return modele.iterator();
   }
   
   /** @pdGenerated default setter
     * @param newModele */
   public void setModele(java.util.Collection<Modele> newModele) {
      removeAllModele();
      for (java.util.Iterator iter = newModele.iterator(); iter.hasNext();)
         addModele((Modele)iter.next());
   }
   
   /** @pdGenerated default add
     * @param newModele */
   public void addModele(Modele newModele) {
      if (newModele == null)
         return;
      if (this.modele == null)
         this.modele = new java.util.HashSet<Modele>();
      if (!this.modele.contains(newModele))
      {
         this.modele.add(newModele);
         newModele.setMarque(this);      
      }
   }
   
   /** @pdGenerated default remove
     * @param oldModele */
   public void removeModele(Modele oldModele) {
      if (oldModele == null)
         return;
      if (this.modele != null)
         if (this.modele.contains(oldModele))
         {
            this.modele.remove(oldModele);
            oldModele.setMarque((Marque)null);
         }
   }
   
   /** @pdGenerated default removeAll */
   public void removeAllModele() {
      if (modele != null)
      {
         Modele oldModele;
         for (java.util.Iterator iter = getIteratorModele(); iter.hasNext();)
         {
            oldModele = (Modele)iter.next();
            iter.remove();
            oldModele.setMarque((Marque)null);
         }
      }
   }

}